package cc.zy.base.businesses.controller;

import cc.zy.base.businesses.entity.*;
import cc.zy.base.businesses.service.*;
import cc.zy.base.common.annotation.ControllerEndpoint;
import cc.zy.base.common.utils.FebsUtil;
import cc.zy.base.common.entity.FebsConstant;
import cc.zy.base.common.controller.BaseController;
import cc.zy.base.common.entity.FebsResponse;
import cc.zy.base.common.entity.QueryRequest;
import cc.zy.base.common.utils.TreeNode;
import cc.zy.base.system.entity.User;
import cc.zy.base.system.service.IUserService;
import com.wuwenze.poi.ExcelKit;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 学生表
 * Controller
 *
 * @author Jiangjinlin
 * @date 2021-01-25 11:45:25
 */
@Slf4j
@Validated
@Controller
@RequiredArgsConstructor
@RequestMapping("student")
public class StudentController extends BaseController {

    @Resource
    private final IStudentService studentService;
    @Resource
    private IUserService userService;
    /**
     * @param request
     * @return
     * @Description: 使用通用组件查询所选择学生
     * @author zhizhao Zhang
     * @date 2021-02-03 11:52:14
     */
    @GetMapping("selectStudentlist")
    @ResponseBody
    public FebsResponse selectStudentlist(Student student, QueryRequest request,Integer tabVal) {

        log.debug(String.format("student = %s, tabVal = %s", student, tabVal));
        User user = getCurrentUser();
        Long userId = user.getUserId();

        Map<String, Object> dataTable = getDataTable(studentService.selectStudentDetailList(student, request, tabVal));

        return new FebsResponse().success().data(dataTable);
    }
}